{extend name="public:layout" /}
{block name="title"}添加{$moudleName}{/block}
{block name="head"}{/block}
{block name="body"}
<?php
$maxsort = \think\Db::table('car_parts')->max('sort');
$maxsort = empty($maxsort)?1:$maxsort+1;
?>
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li>
                    <i class="fa fa-hand-o-right"></i>
                    <a href="{:url('index',['mid'=>$Request.param.mid])}">{$moudleName}列表</a>
                </li>
                <li class="active">添加{$moudleName}</li>
            </ol>
        </div>
        <div class="ibox-content">
            <form method="post" class="form-horizontal" id="form">
                {volist name="layoutForm" id="one"}
                <div class="form-group">
                    {volist name="one" id="two"}
                    {$two.html}
                    {/volist}
                </div>
                {/volist}
                {if (is_numeric($dept_ids))}
                <input type="hidden" name="dept_id" value="{$dept_ids}" />
                {else/}
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">所在部门</label>
                    <div class="col-sm-4">
                        <select name="dept_id" class="form-control">
                            {volist name=":cache('dept')" id="vo"}
                            <option value="{$vo.dept_id}">{$vo._name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
                {/if}
                <div class="form-group">
                    <div class="col-sm-10 col-sm-offset-2">
                        <button class="btn btn-primary" id="btnSub" type="button">保存</button>
                        <a href="{:url('index',['mid'=>$Request.param.mid])}" class="btn btn-white">取消</a>
                        <span id="validError"></span>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    $(function () {
        $("input[name='sort']").val('{$maxsort}');
        iCheck();
        formatDate();
        ajaxSubForm('#btnSub');
    });
</script>
{/block}